angular.module('ishop.goodsService', [])

    //选房
    .factory('GoodsService', function (ENV) {
        // Some fake testing data
        var goods = [{
            id: 0,
            name: '保利拉菲1',
            txt: '精品3房，南北通透，交通便利，环境优美',
            img: ''
        }, {
            id: 1,
            name: '保利拉菲2',
            txt: '精品3房，南北通透，交通便利，环境优美',
            img: ''
        }, {
            id: 2,
            name: '当代国际',
            txt: '精品3房，南北通透，交通便利，环境优美',
            img: ''
        }, {
            id: 3,
            name: '当代国际n',
            txt: '精品3房，南北通透，交通便利，环境优美',
            img: ''
        }, {
            id: 4,
            name: 'Perry Governor',
            txt: '精品3房，南北通透，交通便利，环境优美',
            img: ''
        }];

        return {
            all: function () {
                return goods;
            },
            findGoodses: function () {
                return goods;
            },
            get: function (id) { //详情
                for (var i = 0; i < goods.length; i++) {
                    if (goods[i].id === parseInt(id)) {
                        var images = [{
                            src:'cc'
                        },{
                            src:'cc'
                        }];

                        var good = goods[i];
                        good.images = images;
                        return good;
                    }
                }
                return null;
            }
        };
    })

;
